/**
 * window.localStorage 浏览器永久缓存
 * @method set 设置永久缓存
 * @method get 获取永久缓存
 * @method remove 移除永久缓存
 * @method clear 移除全部永久缓存
 */
export const Local = {
    set(key: string, val: any){
        localStorage.setItem(key, JSON.stringify(val))
    },
    get(key: string){
        const getJson:any = localStorage.getItem(key)
        return JSON.parse(getJson)
    },
    remove(key: string){
        localStorage.removeItem(key)
    },
    clear(){
        localStorage.clear()
    }
}
/**
 * window.sessionStorage 浏览器临时缓存
 * @method set 设置临时缓存
 * @method get 获取临时缓存
 * @method remove 移除临时缓存
 * @method clear 移除全部临时缓存
 */
export const Session = {
    set(key: string, val: any){
        sessionStorage.setItem(key, JSON.stringify(val))
    },
    get(key: string){
        const getJson:any = sessionStorage.getItem(key)
        return JSON.parse(getJson)
    },
    remove(key: string){
        sessionStorage.removeItem(key)
    },
    clear(){
        sessionStorage.clear()
    }
}